package gui;

import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class DeviceMap {
	private WindowsApplication windowsApp;
	private JPanel pnlDeviceMap;
	
	public DeviceMap(){
		initialize();
	}
	public DeviceMap(WindowsApplication windowsApp){
		this.windowsApp = windowsApp;
		initialize();
	}
	private void initialize(){
		pnlDeviceMap = new JPanel();
		pnlDeviceMap.setBounds(0, 0, 800, 600);
		pnlDeviceMap.setLayout(null);
		
		JLabel lblConnectedDeviceMapping = new JLabel("Connected Device Mapping");
		lblConnectedDeviceMapping.setFont(new Font("Arial Rounded MT Bold", Font.PLAIN, 25));
		lblConnectedDeviceMapping.setBounds(306, 25, 400, 30);
		pnlDeviceMap.add(lblConnectedDeviceMapping);
		
		JLabel lblDeviceName = new JLabel("Device Name");
		lblDeviceName.setBounds(12, 13, 150, 22);
		pnlDeviceMap.add(lblDeviceName);
		
		JLabel lblIpAddress = new JLabel("IP Address");
		lblIpAddress.setBounds(12, 48, 150, 22);
		pnlDeviceMap.add(lblIpAddress);
		
		JLabel lblMacAddress = new JLabel("Mac Address");
		lblMacAddress.setBounds(12, 83, 150, 22);
		pnlDeviceMap.add(lblMacAddress);
		
		JButton btnBack = new JButton("Back");
		btnBack.setBounds(668, 32, 120, 25);
		btnBack.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e){
				windowsApp.getFrame().setContentPane(new Overview(windowsApp).getPanel());
			}
		});
		pnlDeviceMap.add(btnBack);
		
		JButton btnAddDevice = new JButton("Add Device");
		btnAddDevice.setBounds(174, 7, 120, 50);
		btnAddDevice.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e){
				System.out.println("AddAction");
			}
		});
		pnlDeviceMap.add(btnAddDevice);
		
		JButton btnRemoveDevice = new JButton("Remove Device");
		btnRemoveDevice.setBounds(174, 69, 120, 50);
		btnRemoveDevice.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e){
				System.out.println("RemoveAction");
			}
		});
		pnlDeviceMap.add(btnRemoveDevice);
		
		JButton btnViewDevice = new JButton("View Device");
		btnViewDevice.setBounds(306, 69, 120, 50);
		btnViewDevice.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent e){
				System.out.println("ViewAction");
				windowsApp.getFrame().setContentPane(new DeviceOverview(windowsApp).getPanel());
			}
		});
		pnlDeviceMap.add(btnViewDevice);
	}
	
	public JPanel getPanel(){
		return pnlDeviceMap;
	}
}
